package com.woniuxy.ticketauth;

import com.woniuxy.ticketauth.controller.TicketCrossFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;

@ServletComponentScan(basePackages = "com.woniuxy.ticketauth.filter")
@SpringBootApplication
public class TicketAuthApplication {

    public static void main(String[] args) {
        SpringApplication.run(TicketAuthApplication.class, args);
    }
    @Bean
    public FilterRegistrationBean<TicketCrossFilter> registrationFilterBean() {
        FilterRegistrationBean<TicketCrossFilter> filterRegistrationBean = new FilterRegistrationBean<>();
        filterRegistrationBean.setFilter(new TicketCrossFilter());
        filterRegistrationBean.addUrlPatterns("/*");
        //设置过滤器顺序
        filterRegistrationBean.setOrder(0);
        filterRegistrationBean.setEnabled(true);
        return filterRegistrationBean;
    }
}
